<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>学生详情 - 教学管理系统</title>
    <style>
        body {
            font-family: 'Microsoft YaHei', sans-serif;
            background-color: #f5f5f5;
            margin: 0;
            padding: 0;
        }

        .container {
            display: flex;
            min-height: 100vh;
        }

        .sidebar {
            width: 250px;
            background-color: #2c3e50;
            color: white;
            padding-top: 20px;
        }

        .sidebar-header {
            padding: 0 20px 20px;
            border-bottom: 1px solid #3c5166;
        }

        .sidebar-header h2 {
            margin: 0;
            font-size: 20px;
        }

        .user-info {
            margin-top: 10px;
            font-size: 14px;
            opacity: 0.8;
        }

        .menu {
            list-style: none;
            padding: 0;
            margin: 20px 0;
        }

        .menu li {
            padding: 12px 20px;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        .menu li:hover {
            background-color: #3c5166;
        }

        .menu li.active {
            background-color: #3498db;
        }

        .menu a {
            color: white;
            text-decoration: none;
            display: block;
        }

        .content {
            flex: 1;
            padding: 20px;
        }

        .content-header {
            margin-bottom: 30px;
        }

        .content-header h1 {
            margin: 0;
            color: #333;
            font-size: 24px;
        }

        .breadcrumb {
            display: flex;
            list-style: none;
            padding: 0;
            margin: 0 0 10px 0;
        }

        .breadcrumb li {
            font-size: 14px;
            color: #777;
        }

        .breadcrumb li:not(:last-child)::after {
            content: '>';
            margin: 0 8px;
        }

        .breadcrumb a {
            color: #3498db;
            text-decoration: none;
        }

        .breadcrumb a:hover {
            text-decoration: underline;
        }

        .student-card {
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            overflow: hidden;
            margin-bottom: 20px;
        }

        .student-header {
            background-color: #3498db;
            color: white;
            padding: 20px;
        }

        .student-name {
            margin: 0;
            font-size: 22px;
        }

        .student-id {
            margin-top: 5px;
            font-size: 14px;
            opacity: 0.8;
        }

        .student-body {
            padding: 20px;
        }

        .info-section {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 15px;
            margin-bottom: 15px;
        }

        .info-item {
            margin-bottom: 10px;
        }

        .info-label {
            color: #888;
            font-size: 12px;
            margin-bottom: 4px;
        }

        .info-value {
            color: #333;
            font-size: 16px;
            font-weight: 500;
        }

        .section-title {
            font-size: 18px;
            color: #333;
            margin: 20px 0 15px 0;
            padding-bottom: 10px;
            border-bottom: 1px solid #eee;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 10px;
        }

        table th,
        table td {
            padding: 12px 15px;
            text-align: left;
            border-bottom: 1px solid #eee;
        }

        table th {
            background-color: #f8f9fa;
            color: #333;
            font-weight: 600;
        }

        table tr:hover {
            background-color: #f5f5f5;
        }

        .btn {
            display: inline-block;
            padding: 6px 12px;
            background-color: #3498db;
            color: white;
            border-radius: 4px;
            text-decoration: none;
            font-size: 14px;
            margin-right: 5px;
        }

        .btn:hover {
            background-color: #2980b9;
        }

        .btn-orange {
            background-color: #f39c12;
        }

        .btn-orange:hover {
            background-color: #e67e22;
        }

        .logout {
            margin-top: auto;
            padding: 20px;
        }

        .logout a {
            color: #e74c3c;
            text-decoration: none;
        }

        .status-icon {
            display: inline-block;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            margin-right: 5px;
        }

        .status-active {
            background-color: #2ecc71;
        }

        .status-completed {
            background-color: #3498db;
        }

        .status-upcoming {
            background-color: #f39c12;
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="sidebar">
            <div class="sidebar-header">
                <h2>教学管理系统</h2>
                <div class="user-info" th:if="${session.user}">
                    <span th:text="${session.user.username}">teacher1</span> - 教师
                </div>
            </div>
            <ul class="menu">
                <li><a href="/teacher/dashboard">我的概览</a></li>
                <li><a href="/teacher/courses">我的课程</a></li>
                <li class="active"><a href="/teacher/students">我的学生</a></li>
                <li><a href="/teacher/grades">成绩管理</a></li>
                <li><a href="/teacher/profile">个人信息</a></li>
            </ul>
            <div class="logout">
                <a href="/logout">退出登录</a>
            </div>
        </div>

        <div class="content">
            <ul class="breadcrumb">
                <li><a href="/teacher/dashboard">我的概览</a></li>
                <li><a href="/teacher/students">我的学生</a></li>
                <li th:text="${student.name}">学生姓名</li>
            </ul>

            <div class="content-header">
                <h1>学生详情</h1>
            </div>

            <div class="student-card">
                <div class="student-header">
                    <h2 class="student-name" th:text="${student.name}">张三</h2>
                    <div class="student-id" th:text="${'学号：' + student.studentId}">学号：20230001</div>
                </div>
                <div class="student-body">
                    <div class="info-section">
                        <div class="info-item">
                            <div class="info-label">性别</div>
                            <div class="info-value" th:text="${student.gender}">男</div>
                        </div>
                        <div class="info-item">
                            <div class="info-label">专业</div>
                            <div class="info-value" th:text="${student.major}">计算机科学与技术</div>
                        </div>
                        <div class="info-item">
                            <div class="info-label">年级</div>
                            <div class="info-value" th:text="${student.grade}">大二上</div>
                        </div>
                        <div class="info-item">
                            <div class="info-label">班级</div>
                            <div class="info-value" th:text="${student.className}">计算机1班</div>
                        </div>
                    </div>

                    <div class="info-section">
                        <div class="info-item">
                            <div class="info-label">出生日期</div>
                            <div class="info-value" th:text="${#dates.format(student.birthDate, 'yyyy-MM-dd')}">
                                2000-01-01</div>
                        </div>
                        <div class="info-item">
                            <div class="info-label">入学日期</div>
                            <div class="info-value" th:text="${#dates.format(student.enrollmentDate, 'yyyy-MM-dd')}">
                                2020-09-01</div>
                        </div>
                    </div>
                </div>
            </div>

            <h3 class="section-title">选修课程</h3>

            <div class="student-card">
                <div class="student-body">
                    <table>
                        <thead>
                            <tr>
                                <th>课程编号</th>
                                <th>课程名称</th>
                                <th>学分</th>
                                <th>类型</th>
                                <th>学期</th>
                                <th>状态</th>
                                <th>成绩</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr th:if="${courses == null || courses.isEmpty()}">
                                <td colspan="8" style="text-align: center;">暂无课程选修记录</td>
                            </tr>
                            <tr th:each="course : ${courses}">
                                <td th:text="${course.courseId}">CS101</td>
                                <td th:text="${course.courseName}">计算机导论</td>
                                <td th:text="${course.credit}">4</td>
                                <td th:text="${course.courseType}">必修课</td>
                                <td th:text="${course.semester}">大一上</td>
                                <td>
                                    <span th:if="${course.status == '正在修'}" class="status-icon status-active"
                                        title="正在修"></span>
                                    <span th:if="${course.status == '已修'}" class="status-icon status-completed"
                                        title="已修"></span>
                                    <span th:if="${course.status == '未修'}" class="status-icon status-upcoming"
                                        title="未修"></span>
                                    <span th:text="${course.status}">正在修</span>
                                </td>
                                <td th:text="${course.score != null ? course.score : '未评分'}">85</td>
                                <td>
                                    <a th:href="@{'/teacher/course/' + ${course.courseId}}" class="btn">课程详情</a>
                                    <a th:href="@{'/teacher/course/' + ${course.courseId} + '/student/' + ${student.studentId} + '/grade'}"
                                        class="btn btn-orange">录入成绩</a>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</body>

</html>